library(tidyverse)
library(readxl)
library(stringi)
path = "Excel/699 Palindrome after one character removal.xlsx"
input = read_excel(path, range = "A1:A10")
test = read_excel(path, range = "B1:B10") %>%
replace_na(list(`Answer Expected` = ""))
remove_each_char <- function(word) {
map_chr(
seq_len(nchar(word)),
\(i) paste0(substr(word, 1, i - 1), substr(word, i + 1, nchar(word)))
)
}
is_palindrome = function(word) {
word == stri_reverse(word)
}
result = input %>%
mutate(words = map(Words, remove_each_char)) %>%
unnest_longer(words) %>%
mutate(is_palindrome = map_lgl(words, is_palindrome)) %>%
filter(is_palindrome) %>%
select(-is_palindrome)
result2 = input %>%
left_join(result, by = c("Words" = "Words")) %>%
replace_na(list(words = ""))Excel BI - Excel Challenge 699
excel-challenges
excel-formulas
🔰 Only one alphabet can be removed from Words list and it should become a palindrome.

Challenge Description
🔰 Only one alphabet can be removed from Words list and it should become a palindrome. List the palindrome word so generated. If no answer is possible, answer will be blank.
Solutions
- Logic: Read the workbook ranges needed for the challenge; Derive the required intermediate columns.
- Strengths: The code maps the workbook rule into a compact, reproducible pipeline.
- Areas for Improvement: The solution assumes the workbook layout and selected ranges remain stable, so any structural change in the sheet would require small adjustments.
- Gem: The elegant part is how little code is needed once the correct intermediate representation is chosen.
import pandas as pd
path = "699 Palindrome after one character removal.xlsx"
input = pd.read_excel(path, usecols="A", nrows=10, names=["Words"])
test = pd.read_excel(path, usecols="B", nrows=10, names=["Answer Expected"]).fillna("")
def is_palindrome(word):
return word == word[::-1]
result = input["Words"].apply(
lambda word: next((word[:i] + word[i+1:] for i in range(len(word)) if is_palindrome(word[:i] + word[i+1:])), "")
)
print(result)The Python version keeps the algorithm explicit, which helps when the challenge depends on a greedy or iterative rule.
Difficulty Level
Easy / Medium
The business rule is clear, though the workbook still needs a few transformation steps to reach the expected output.